package com.neuedu.date;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateExample2 {
	public static void main(String[] args) throws ParseException {
		//如何把字符串转换为日期
		
		String dateString="2018-05-06";
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		Date date=sdf.parse(dateString);
		/*System.out.println(date);*/
		Calendar calendar=Calendar.getInstance();
		calendar.setTime(date);
		System.out.println(calendar.get(Calendar.YEAR)+"年"+(calendar.get(Calendar.MONTH)+1)+"月"+calendar.get(Calendar.DATE)+"日");
		
	}

}
